// custom-tab-bar/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    allList: [
      [{
          "pagePath": "/pages/OrderPage/OrderPage",
          "text": "订单",
          "iconPath": "/images/tabbaricon/order.png",
          "selectedIconPath": "/images/tabbaricon/orderactive.png",
          "selected": "00"
        }, {
          "pagePath": "/pages/DeliveryTime/DeliveryTime",
          "text": "交付",
          "iconPath": "/images/tabbaricon/timer.png",
          "selectedIconPath": "/images/tabbaricon/timeractive.png",
          "selected": "01"
        },
        {
          "pagePath": "/pages/Manufactor/Manufactor",
          "text": "厂家",
          "iconPath": "/images/tabbaricon/manufactor.png",
          "selectedIconPath": "/images/tabbaricon/manufactoractive.png",
          "selected": "02"
        },
        {
          "pagePath": "/pages/User/User",
          "text": "用户",
          "iconPath": "/images/tabbaricon/user.png",
          "selectedIconPath": "/images/tabbaricon/useractive.png",
          "selected": "03"
        },
        {
          "pagePath": "/pages/computer/computer",
          "text": "计算",
          "iconPath": "/images/tabbaricon/computer.png",
          "selectedIconPath": "/images/tabbaricon/computeractive.png",
          "selected": "04"
        }
      ],
      [{
          "pagePath": "/pages/ManufactorOrder/ManufactorOrder",
          "text": "厂家订单",
          "iconPath": "/images/tabbaricon/order.png",
          "selectedIconPath": "/images/tabbaricon/orderactive.png",
          "selected": "05"
        }
      ],
      [{
          "pagePath": "/pages/UserOrder/UserOrder",
          "text": "用户订单",
          "iconPath": "/images/tabbaricon/order.png",
          "selectedIconPath": "/images/tabbaricon/orderactive.png",
          "selected": "06"
        }
      ]
    ],
    selectList: [],
  },
  /**
   * 生命周期的方法：当组件被加载的时候调用
   */
  created() {},
  ready() {
    if (wx.getStorageSync('user') == "Boss") {
      this.setData({
        selectList: this.data.allList[0]
      })
    } else if (wx.getStorageSync('user') == "Manufacturer") {
      this.setData({
        selectList: this.data.allList[1]
      })
    } else if (wx.getStorageSync('user') == "Users") {
      this.setData({
        selectList: this.data.allList[2]
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    swichTo(e) {
      // console.dir(e);
      let path = e.currentTarget.dataset.path;
      wx.switchTab({
        url: path,
      })
    }
  }
})